package twLogicQuizSubmission

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("GET")
        url("/api/tw-logic-quiz-submission/summary") {
            queryParameters {
                parameter("assignmentId", 1)
                parameter("quizId", 1)
            }
        }
        headers {
            header("id", 1)
            contentType(applicationJsonUtf8())
        }
    }

    response {
        status(200)
        body("""
            {
                "id":1,
                "assignmentId":1,
                "userId":1,
                "quizId":1,
                "status":"finished"
            }
        """)
        bodyMatchers {
            jsonPath('$.id', byRegex(number()))
            jsonPath('$.assignmentId', byRegex(number()))
            jsonPath('$.userId', byRegex(number()))
            jsonPath('$.quizId', byRegex(number()))
            jsonPath('$.status', byRegex("[\\s\\S]+"))
        }
        headers {
            contentType(applicationJsonUtf8())
        }
    }
}
